<?php
namespace app\common\exception;

use Exception;
use think\exception\Handle;

class BaseException extends Handle
{
    /**
     * 异常处理
     * User: zhouyao
     * Date: 2018/9/7
     * Time: 上午10:13
     * @param Exception $e
     * @return \think\Response
     * @throws AppException
     */
    public function render(Exception $e)
    {
        if ($e instanceof AppException) {
            return app_response($e->getCode(), $e->getMessage(), $e->getVars());
        }

        // 其他错误交给系统处理
       return parent::render($e);
    }

}